 <!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>我的大学</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/main.css" />
    <link rel="stylesheet" type="text/css" href="../css/colleague.css" />
</head>
<body>
  <div id="header">
      <h3>我的大学</h3>
  </div>
  <div class="person">
    <div class="img-set">
      <div class="person_img">

      </div>
      <!-- <div class="person_set">

      </div> -->
    </div>
    <div class="person_span">
        <p>显示中</p>
        <!-- <p>简介：软件工程  HTML前端工程师</p> -->
        <br>
    </div>
  </div>
  <div id = "footer">
    <div class = "footer footer_8">
      <div class="footer_img" style="background-image: url(../image/weChat.png);"></div>
      <div class="footer_span">
        <span>我的聊天</span>
      </div>
      <div class="go"></div>
    </div>
      <div class = "footer footer_1">
        <div class="footer_img" style="background-image: url(../image/my.png);"></div>
        <div class="footer_span">
          <span>职业能力标准</span>
        </div>
        <div class="go"></div>
      </div>
      <div class = "footer footer_7">
        <div class="footer_img" style="background-image: url(../image/setting.png);"></div>
        <div class="footer_span">
          <span>职业标准管理</span>
        </div>
        <div class="go"></div>
      </div>
      <div class = "footer footer_2">
        <div class="footer_img" style="background-image: url(../image/yijian3.png);"></div>
        <div class="footer_span">
          <span>意见反馈</span>
        </div>
        <div class="go"></div>
      </div>
      <div class = "footer footer_3">
        <div class="footer_img" style="background-image: url(../image/apply.png);"></div>
        <div class="footer_span">
          <span>申请成为项目经理</span>
        </div>
        <div class="go"></div>
      </div>
      <!-- <div class = "footer footer_4">
        <div class="footer_img" style="background-image: url(../image/apply.png);"></div>
        <div class="footer_span">
          <span>申请成为版主</span>
        </div>
        <div class="go"></div>
      </div> -->
      <div class = "footer footer_5">
        <div class="footer_img" style="background-image: url(../image/apply.png);"></div>
        <div class="footer_span">
          <span>版主管理</span>
        </div>
        <div class="go"></div>
      </div>
      <div class = "footer footer_6">
        <div class="footer_img" style="background-image: url(../image/shezhi.png);"></div>
        <div class="footer_span">
          <span>系统设置与说明</span>
        </div>
        <div class="go"></div>
      </div>
  </div>
  <div class="bottom"></div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/main.js"></script>
<script type="text/javascript">

  $(".person_set").click(function(){
    if($api.getStorage('aid') == 1){
      api.toast({
          msg: '此功能仅提供用户使用'
      });
    }
    else{
      api.confirm({
          title: '选择图片',
          msg: '您想要从哪里选取图片 ?',
          buttons: ['拍照', '相册', '取消']
      }, function(ret, err) {
          var sourceType = 'album';

          if (3 == ret.buttonIndex) { // 取消
              return;
          }

          if (1 == ret.buttonIndex) { // 打开相机
              sourceType = 'camera';
          }

          api.getPicture({
              sourceType: sourceType,
              destinationType:'base64'
          }, function(ret, err) {
            if(err){
              alert('取消操作！');
            }else{
              if(ret.data.length){
                 var url='/api/paTechnicaluser/'+$api.getStorage("aid")+'/header';
                 var headImages=ret.base64Data.split(",")[1];
                 var functionRet=function(ret){
                    console.log(JSON.stringify(ret))
                 }
                 var functionErr=function(err){
                   if(err.statusCode==200){
                     api.alert({ msg: '头像修改成功！' });
                   }else{
                     toast("头像修改失败，请重试","bottom");
                   }
                 }
                 var jsons={
                    "headImages": ret.base64Data.split(",")[1],
                    "headImagesType": "jpg"
                 };
                 put(url,jsons,functionRet,functionErr);
                 $(".person_img").css("background-image","url("+ret.base64Data+")");
              }else{
                if(ret.data.length==0){
                  toast("取消修改头像","bottom");
                }else {
                  toast("上传头像失败！","bottom");
                }
              }
            }
          });
      });
    }
  })
</script>
<script type="text/javascript">
apiready=function(){

//获取信息
var aid=$api.getStorage('aid');
var flag=$api.getStorage('flag');
var token=$api.getStorage('jwt');
//项目经理
if(flag==3){
  //$(".footer_3").hide();
}else{
  $(".footer_4").hide();
}

//超级管理员
if(flag==7){
  $(".footer_5").show();
  $(".footer_7").show();
  $(".footer_3").hide();
  $(".footer_4").hide();
}
var url='http://47.104.170.122/v1/portal/auth/app/loginInfo?token='+token;
api.ajax({
  url: url,
  method: 'GET',
  headers: {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Headers": "Authorization",
    "Content-Type" : 'application/json; charset=utf-8'
  }
}, function(ret, err) {
    if (ret.code==0) {
        var headImagesUrl=ret.data.userHeaderImageUrl;
        if(headImagesUrl=="#"){
          headImagesUrl='../image/personal_head.png';
        }
        var nickname=ret.data.nickname;
        $(".person_img").css("background-image","url("+headImagesUrl+")");
        $(".person_span p").html(nickname);
    } else {
      toast("加载个人资料失败！","bottom");
    }
});
// var functionRet=function(ret){
//   var headImagesUrl=ret.headImagesUrl;
//   var nickname=ret.nickname;
//   $(".person_img").css("background-image","url("+headImagesUrl+")");
//   $(".person_span p").html(nickname);
// }
// var functionErr=function(err){
//   toast("加载个人资料失败！","bottom");
// }
// if(flag!=7){
//   get(url,functionRet,functionErr);
// }

var MNNavigationMenu = api.require('MNNavigationMenu');
MNNavigationMenu.open({
    rect: {
        x: 0,
        y: 224,
        w: api.winWidth,
        h: 56
    },
    index: 0,
    animation: true,
    styles: {
        column: 4,
        // bg: '#f7f7f7',
        item: {
            // bg: 'rgba(247,247,247,0.7)',
            title: {
                marginB: 4,
                size: 14,
                height: 14,
                color: '#8a8a8a',
                active: '#8a8a8a',
                // highlight: '#37acfe',
                ttf:'Alkatip Basma Tom'
            },
            icon: {
                marginT: 3,
                width: 32,
                height: 32,
                corner: 2
            }
        }
    },
    items: [{
        title: '个人信息',
        icon: 'widget://image/jianli.png',
        active: 'widget://image/jianli.png',
        highlight: 'widget://image/jianli.png'
    }, {
        title: '我的项目',
        icon: 'widget://image/toudi.png',
        active: 'widget://image/toudi.png',
        highlight: 'widget://image/toudi.png'
    },{
        title: '我的帖子',
        icon: 'widget://image/essay.png',
        active: 'widget://image/essay.png',
        highlight: 'widget://image/essay.png'
    }, {
        title: '我的关注',
        icon: 'widget://image/guanzhu.png',
        active: 'widget://image/guanzhu.png',
        highlight: 'widget://image/guanzhu.png'
    }],
    fixedOn: api.frameName,
    fixed: false
}, function(ret, err) {
    if(ret){
      if(ret.index==0){
        if(aid == 1){
          api.toast({
              msg: '此功能仅提供用户使用'
          });
        }
        else{
          openPage('resume','./colleague/resume.html');
        }
      }
      if(ret.index==1){
        openPage('send','./colleague/send.html');
      }
      if(ret.index==2){
        openPage('myArticle','forum/myArticle.html');
      }
      if(ret.index==3){
        //关注的帖子
        openPage('attentionArticle','forum/attentionArticle.html');
      }
    }
});

//职业能力标准
　　$(".footer_1").on('click',function(){

　　　　openPage('my_job','./colleague/my_job.html');
　　});

//意见反馈
    $(".footer_2").on('click',function(){
      if(flag==7){
        openPageAble('opinion_list','./colleague/opinion_list.html');
      }else{
        openPageAble('opinion','./colleague/opinion.html');
      }
　　});
    //申请成为项目经理
    $(".footer_3").on('click',function(){
          openPage('opinion','./colleague/apply.html');
  　});
   //申请成为版主
    $(".footer_4").on('click',function(){
      var url='/api/moderator-applies/moderatorType?aid='+aid;
      var functionRet=function(ret1){
      }
      var functionErr=function(err1){
        if(err1.statusCode==200){
          toast("您已经是版主了！","middle");
        }else{
          openPage('opinion','./colleague/apply_public.html');
        }
      }
      get(url,functionRet,functionErr);
 　 });
   //审核版主
    $(".footer_5").on('click',function(){
         openPage('apply_list','./colleague/boardmanager.html');
 　 });
   //设置
    $(".footer_6").on('click',function(){
  　　　openPage('opinion','./colleague/setting.html');
  　});
  //职业标准管理
   $(".footer_7").on('click',function(){
 　　　openPage('manage','./colleague/manage.html');
 　});
 //职业标准管理
  $(".footer_8").on('click',function(){
　　　openPage('chatContacts','./project/chatContacts.html');
　});
}
</script>
<script>
  $(function(){

  　　// footer_1 的点击事件

  })
</script>
</html>
